﻿using System;

namespace IOA.MES.EsbApi.Models.Response
{
    /// <summary>
    /// 统一返回
    /// </summary>
    public class BaseResponse
    {
        /// <summary>
        /// ESB 内容
        /// </summary>
        public EsbResponseInfo esbInfo { get; set; } = new EsbResponseInfo();
    }

    public class EsbResponseInfo
    {
        /// <summary>
        /// 接口实例ID
        /// </summary>
        public string instId { get; set; } = Guid.NewGuid().ToString();

        /// <summary>
        /// 返回状态
        /// </summary>
        public string returnStatus { get; set; } = "S";

        /// <summary>
        /// 返回状态
        /// </summary>
        public string returnCode { get; set; } = "A0001";

        /// <summary>
        /// 返回信息
        /// </summary>
        public string returnMsg { get; set; }

        /// <summary>
        /// 请求时间
        /// </summary>
        public string requestTime { get; set; }

        /// <summary>
        /// 返回时间
        /// </summary>
        public string responseTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string attr1 { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string attr2 { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string attr3 { get; set; }

        /// <summary>
        /// 正常返回对象
        /// </summary>
        public EsbResponseInfo() { }

        /// <summary>
        /// 异常返回对象
        /// </summary>
        /// <param name="code">返回代码</param>
        /// <param name="status">返回状态</param>
        /// <param name="msg">返回信息</param>
        public EsbResponseInfo(string code, string status = "E", string msg = "")
        {
            this.returnCode = code;
            this.returnStatus = status;
            this.returnMsg = msg;
        }
    }
}
